//#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int>vec[100005];
int ans[100005] = { 0 }, low[100005] = { 0 }, dfn[100005] = { 0 }, timestamps = 0;
int n, m;
int sz[100005] = { 0 };
void tarjan(int u) {
	dfn[u] = low[u] = ++timestamps;
	long long length = n - 1;
	sz[u] = 1;
	ans[u] = length;
	for (int v : vec[u]) {
		if (!dfn[v]) {
			tarjan(v);
			low[u] = min(low[u], low[v]);
			sz[u] += sz[v];
			if (low[v] >= dfn[u]){
				ans[u] += sz[v] * (n - sz[v]);
				length -= sz[v];
			}
		}
		else {
			low[u] = min(low[u], dfn[v]);
		}
	}
	ans[u] += length * (n - length);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	for (int i = 0;i < m;i++) {
		int u, v;
		cin >> u >> v;
		vec[u].push_back(v);
		vec[v].push_back(u);
	}
	tarjan(1);
	for (int i = 1;i <= n;i++) {
		cout << ans[i] << endl;
	}

	return 0;
}